<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="app">
    <p>numbers.a的值{{numbers.a}}</p>
    <button @click="numbers.a++">+1</button>
    <p>numbers.b的值{{numbers.b}}</p>
    <button @click="numbers.b++">+1</button>

</div>
<script src="../JavaScript/vue.js"></script>
<script>
    const vm=new Vue({
        el:"#app",
        data:{
            numbers:{a:1, b:2,}
        },
        watch:{
            //监听对象中某一个属性的变化
           /* "numbers.a":{
                handler(newV,oldV){
                    console.log(newV,oldV)
                }
            },*/
            //监听对象中某一个属性的变化
            /*"numbers.b":{
                handler(newV,oldV){
                    console.log(newV,oldV)
                }
            },*/
            numbers:{
                deep:true,
                handler(newV,oldV){
                    console.log(newV,oldV)
                }
            }
        }
    })
</script>
</body>
</html>
